package com.lpx.demo.demo.controller;

import com.lpx.demo.demo.dao.base.BaseMenuDao;
import com.lpx.demo.demo.entity.BaseMenuEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description :菜单控制层
 * @Date 2021/1/25 11:02
 * @Author lpx
 */
@Controller
@RequestMapping("/menu")
public class BaseMenuController {
    @Autowired
    private BaseMenuDao baseMenuDao;

    @RequestMapping("/indexMenu")
    public String index() {
        return "/menu/indexMenu";
    }

    @GetMapping("/getMenuAll")
    @ResponseBody
    public Map getMenuAll() {
        List<BaseMenuEntity> list = baseMenuDao.selectList(null);
        Map map = new HashMap();
        map.put("code", 0);
        map.put("msg", "");
        map.put("data", list);
        return map;
    }
}
